class UserInfo {
   int id;
   String userName;
   String signature;
   String phoneNumber;
  /**
   * 男生为1,女生为0
   */
   bool gender;
   String email;
   String qqNumber;
   String vxNumber;
   int ipAddress;
   DateTime birthday;
   String profile;
   String currentAddress;
   String hometown;
   String  graduatedSchool;

   UserInfo(
      this.id,
      this.userName,
      this.signature,
      this.phoneNumber,
      this.gender,
      this.email,
      this.qqNumber,
      this.vxNumber,
      this.ipAddress,
      this.birthday,
      this.profile,
       this.currentAddress,
      this.hometown,
      this.graduatedSchool);

   UserInfo.test(): id = 1, userName = "你好呀", signature = "个性签名", phoneNumber = "1231231", gender = true,
   email = "2312312@qq.com",  qqNumber = "12312312", vxNumber = "vxf123123123", ipAddress = 123132123123, birthday = DateTime(2001),
   profile = "http//profile.jpg", currentAddress = "中国", hometown = "中国", graduatedSchool = "北京大学";

   UserInfo.empty(): id = 0, userName = "", signature = "", phoneNumber = "", gender = true,
   email = "", qqNumber = "", vxNumber = "", ipAddress = 0, birthday = DateTime(2001), profile = "",
   currentAddress = "", hometown = "", graduatedSchool = "";

   factory UserInfo.fromJson(Map<String, dynamic> json) {
     var b = json['birthday'] as String;
     return UserInfo(json['id'], json['userName'], json['signature'], json['phoneNumber'], json['gender'], json['email'],
         json['qqNumber'], json['vxNumber'], json['ipAddress'], b == null ? null : DateTime.parse(b), json['profile'],
         json['currentAddress'], json['hometown'], json['graduatedSchool']);
   }

  @override
  String toString() {
    return 'id $id, profile $profile, userName: $userName';
  }

  void setFieldValue(String fieldName, String value) {
     switch(fieldName) {
       case "userName": {
         userName = value;
         break;
       }
       case "phoneNumber":
         phoneNumber = value;
          break;
       case "email":
         email = value;
         break;
       case "vxNumber":
         vxNumber = value;
         break;
       case "qqNumber":
         qqNumber = value;
         break;
       case "signature":
         signature = value;
         break;
     }
  }
}